<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Caching by last modification</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.http-cache-etag.html">http_cache_etag</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.http-chunked-decode.html">http_chunked_decode</a></div>
 <div class="up"><a href="ref.http.html">HTTP 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.http-cache-last-modified" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">http_cache_last_modified</h1>
  <p class="verinfo">(PECL pecl_http &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">http_cache_last_modified</span> &mdash; <span class="dc-title">Caching by last modification</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.http-cache-last-modified-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>http_cache_last_modified</strong></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$timestamp_or_expires</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Attempts to cache the sent entity by its last modification date.
  </p>
  <p class="para">
   If the supplied argument is greater than 0, it is handled as timestamp
   and will be sent as date of last modification. If it is 0 or omitted,
   the current time will be sent as <em>Last-Modified</em> date.
   If it&#039;s negative, it is handled as expiration time in seconds, which means 
   that if the requested last modification date is not between the calculated timespan,
   the <em>Last-Modified</em> header is updated and the actual body will be sent.
  </p>
  <p class="para">
   A log entry will be written to the cache log if the <a href="http.configuration.html" class="link">INI 设置</a>
   <a href="" class="link">http.log.cache</a> is set
   and the cache attempt was successful.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">此函数可与
<span class="function"><a href="function.http-send-data.html" class="function">http_send_data()</a></span>, <span class="function"><a href="function.http-send-file.html" class="function">http_send_file()</a></span>  和  <span class="function"><a href="function.http-send-stream.html" class="function">http_send_stream()</a></span> 一同使用。</span></p></blockquote>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.http-cache-last-modified-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">timestamp_or_expires</code></em></dt>

     <dd>

      <p class="para">
       Unix timestamp
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.http-cache-last-modified-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回 <strong><code>FALSE</code></strong> 或在成功时返回<em class="emphasis">出口</em>信息 with <em>304 Not Modified</em> if the entity is cached.
   要知道“出口”的含义请查阅
<a href="http.configuration.html" class="link">INI 设置</a>
<a href="" class="link">http.force_exit</a>。
  </p>
 </div>


 


 


 <div class="refsect1 examples" id="refsect1-function.http-cache-last-modified-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4266">
    <p><strong>Example #1 A <span class="function"><strong>http_cache_last_modified()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     Caching for 5 seconds.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />http_cache_last_modified</span><span style="color: #007700">(-</span><span style="color: #0000BB">5</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">http_date</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>



 <div class="refsect1 seealso" id="refsect1-function.http-cache-last-modified-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.http-cache-etag.html" class="function" rel="rdfs-seeAlso">http_cache_etag()</a> - Caching by ETag</span></li>
    <li class="member">如使用 PHP 5.1.0 及以后版本中为
<a href="class.httpresponse.html" class="link">
<a href="class.httpresponse.html" class="classname">HttpResponse</a></a> 类。</li>
   </ul>
  </p>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.http-cache-etag.html">http_cache_etag</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.http-chunked-decode.html">http_chunked_decode</a></div>
 <div class="up"><a href="ref.http.html">HTTP 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
